---
title: "Replication README for Racial Cues from Unfamiliar Sources and Their Effects on Americans' Policy Preferences"
author: "Viviana Rivera-Burgos"
output:
  html_document:
    df_print: paged
  pdf_document: default
---

# Overview

This repository contains replication materials for the manuscript "Racial Cues from Unfamiliar Sources and Their Effects on Americans' Policy Preferences" by Viviana Rivera-Burgos in the *Journal of Experimental Political Science* (JEPS).

## Computational Requirements

I ran the code on a 2023 MacBook Pro with an Apple M3 Max chip and 36 GB memory. The operating system is Sonoma 14.7.1. The R version is 4.4.2 (2024-10-31) and the RStudio version is 2025.05.0+496.

### Software Stack

- R Version: 4.4.2 (2024-10-31)
- RStudio Version: 2025.05.0+496

### R Packages Used in Data Analysis and Table Generation

  - `dplyr` (version 1.1.4)
  - `randomizr` (version 1.0.0)
  - `readr` (version 2.1.5)
  - `haven` (version 2.5.5)

## Data

### Files

  - `data/raw_data/raw_data.csv`
  - `data/raw_data/survey_instrument.pdf`
  - `data/raw_data/ACS/S0101/ACSST1Y2016.S0101-Data.csv`
  - `data/raw_data/ACS/S1501/ACSST1Y2016.S1501-Data.csv`
  - `data/raw_data/ACS/DP05/ACSDP1Y2016.DP05-Data.csv`
  - `data/raw_data/ACS/DP03/ACSDP1Y2016.DP03-Data.csv`
  - `data/raw_data/ACS/DP02/ACSDP1Y2016.DP02-Data.csv`
  - `data/raw_data/PEW/Typology 17 public.sav`
  - `data/raw_data/ANES/anes_timeseries_2016.dta`
  - `data/data.RData`

### Description

  - `data/raw_data/raw_data.csv`; Raw individual-level data from the MTurk experiment.
  - `data/raw_data/survey_instrument.pdf`; Original survey instrument for MTurk experiment.
  - `data/raw_data/ACS/S0101/ACSST1Y2016.S0101-Data.csv`; American Community Survey (ACS) 2016 1-Year Estimates, Table S0101: Age and Sex.
  - `data/raw_data/ACS/S1501/ACSST1Y2016.S1501-Data.csv`; ACS 2016 1-Year Estimates, Table S1501: Educational Attainment.
  - `data/raw_data/ACS/DP05/ACSDP1Y2016.DP05-Data.csv`; ACS 2016 1-Year Data Profile, Table DP05: Demographic and Housing Estimates.
  - `data/raw_data/ACS/DP03/ACSDP1Y2016.DP03-Data.csv`; ACS 2016 1-Year Data Profile, Table DP03: Selected Economic Characteristics.
  - `data/raw_data/ACS/DP02/ACSDP1Y2016.DP02-Data.csv`; ACS 2016 1-Year Data Profile, Table DP02: Selected Social Characteristics.
  - `data/raw_data/PEW/Typology 17 public.sav`; Pew Research Center’s 2017 Political Typology Survey.
  - `data/raw_data/ANES/anes_timeseries_2016.dta`; 2016 American National Election Studies (ANES) Time Series dataset.
  - `data/data.RData`; Cleaned and recoded version of the MTurk experimental dataset.

### Files
  - `install_packages.R`
  - `master.R`
  - `data/clean_data.R`
  - `code_and_output/helper_functions.R`
  - `code_and_output/tab_1_code.R`
  - `code_and_output/tab_3_code.R`
  - `code_and_output/tab_4_code.R`
  - `code_and_output/tab_5_code.R`
  - `code_and_output/tab_6_code.R`
  - `code_and_output/tab_7_code.R`
  - `code_and_output/tab_8_code.R`
  - `code_and_output/tables/table_1.tex`
  - `code_and_output/tables/table_3.tex`
  - `code_and_output/tables/table_4.tex`
  - `code_and_output/tables/table_5.tex`
  - `code_and_output/tables/table_6.tex`
  - `code_and_output/tables/table_7.tex`
  - `code_and_output/tables/table_8.tex`

### Description

  - `install_packages.R`; Installs all required R packages for replication.
  - `master.R`; Main script that sources all data cleaning and analysis files in the correct order to reproduce results and tables.
  - `data/clean_data.R`; Cleans and recodes the raw MTurk dataset.
  - `code_and_output/helper_functions.R`; Defines custom formatting functions for table-generating scripts.
  - `code_and_output/tab_1_code.R`; Generates Table 1.
  - `code_and_output/tab_3_code.R`; Generates Table 3.
  - `code_and_output/tab_4_code.R`; Generates Table 4.
  - `code_and_output/tab_5_code.R`; Generates Table 5.
  - `code_and_output/tab_6_code.R`; Generates Table 6.
  - `code_and_output/tab_7_code.R`; Generates Table 7.
  - `code_and_output/tab_8_code.R`; Generates Table 8.
  - `code_and_output/tables/table_1.tex`; LaTeX-formatted Table 1. 
  - `code_and_output/tables/table_3.tex`; LaTeX-formatted Table 3.
  - `code_and_output/tables/table_4.tex`; LaTeX-formatted Table 4.
  - `code_and_output/tables/table_5.tex`; LaTeX-formatted Table 5.
  - `code_and_output/tables/table_6.tex`; LaTeX-formatted Table 6.
  - `code_and_output/tables/table_7.tex`; LaTeX-formatted Table 7.
  - `code_and_output/tables/table_8.tex`; LaTeX-formatted Table 8.

## Runtime Estimates

Each analysis script (tab_1_code.R through tab_8_code.R) is designed to run independently and reproduce the corresponding table in the manuscript. Supporting scripts handle package installation, data cleaning, and helper functions used across analyses.. Approximate run times below are based on a 2023 MacBook Pro with an Apple M3 Max chip and 36 GB RAM.

 - `install_packages.R`: 31 seconds.
  - `master.R`: 76 seconds.
  - `data/clean_data.R`: 0.1 seconds
  - `code_and_output/tab_1_code.R`: 1 second
  - `code_and_output/tab_3_code.R`: 0.04 seconds
  - `code_and_output/tab_4_code.R`: 0.05 seconds
  - `code_and_output/tab_5_code.R`: 7 seconds.
  - `code_and_output/tab_6_code.R`: 9 seconds.
  - `code_and_output/tab_7_code.R`: 13 seconds.
  - `code_and_output/tab_8_code.R`: 13 seconds

## Citation

If using these materials, please cite the original paper:

> Rivera-Burgos, Viviana. "Racial Cues from Unfamiliar Sources and Their Effects on Americans' Policy Preferences." *Journal of Experimental Political Science*. Forthcoming.
